/**
 * Copyright (C), 2015-2021, XXX有限公司
 * FileName: dpTestServiceImpl
 * Author:   Administrator
 * Date:     2021/7/29 0029 11:24
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package cn.hxlc.tie.demo.modular.xjf.testEquipment.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hxlc.tie.demo.modular.xjf.testEquipment.entity.dpTest;
import cn.hxlc.tie.demo.modular.xjf.testEquipment.mapper.dpTestMapper;
import cn.hxlc.tie.demo.modular.xjf.testEquipment.model.Params.dpTestParam;
import cn.hxlc.tie.demo.modular.xjf.testEquipment.model.Result.dpTestResult;
import cn.hxlc.tie.demo.modular.xjf.testEquipment.service.dpTestService;
import cn.hxlc.tie.libs.mp.page.PageFactory;
import cn.hxlc.tie.model.page.PageResult;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author Administrator
 * @create 2021/7/29 0029
 * @since 1.0.0
 */
@Service
@Transactional
public class dpTestServiceImpl extends ServiceImpl<dpTestMapper, dpTest> implements dpTestService {



    @Transactional(rollbackFor = Exception.class)
    @Override
    public PageResult<dpTestResult> queryDp(dpTestResult param){
        Page<dpTestResult> workShopPage= PageFactory.defaultPage();
        IPage<dpTestResult> resultPage= this.baseMapper.queryDp(workShopPage,param);

        return new PageResult<>(resultPage);
    }



    @Transactional(rollbackFor = Exception.class)
    @Override
    public void add(dpTestParam param){
        dpTest entity = getEntity(param);


       //entity.setDpNumber(entity.getDpNumber()+1);
        //this.save(entity);
    }


    private dpTest getEntity(dpTestParam param) {
        dpTest entity = new dpTest();
        BeanUtil.copyProperties(param, entity);
        return entity;
    }

    @Override
    public List<dpTestResult> findListBySpec(dpTestParam param){

        return this.baseMapper.customList(param);
    }


}
